import React, { useEffect, useState } from 'react'
import { useLocation } from 'react-router-dom';
import axios from 'axios';
export default function Zhi() {
    //获取路由参数
    let location = useLocation();
    const [out_trade_no, setout_trade_no] = useState([])
    const [trade_no, settrade_no] = useState([])
    useEffect(() => {
        location.search.split('&').map(item => {
            if (item.split('=')[0] === 'out_trade_no') {
                setout_trade_no(item.split('=')[1]);
            }
            if (item.split('=')[0] === 'trade_no') {
                settrade_no(item.split('=')[1]);
            }
        })
    }, [])
    const [mess, setmess] = useState([])
    useEffect(() => {
        console.log(out_trade_no, trade_no);
        if (out_trade_no.length !== 0) {
            axios.post('http://localhost:3000/ycf/paymentQuery', { out_trade_no, trade_no }).then(data => {
                //支付的状态
                setmess(data.data.message);
            })
        }
    })
    return (
        <div>
            123
        </div>
    )
}

